package com.uzai.console.enums;

/**
 * 发单商品变量枚举
 * @Auther: liuqi
 * @Date: 2021/8/19 11:22
 * @Description:
 */
public enum FdGoodsParaEnum {
    PWD(0,"[淘口令+%s]", "\\[淘口令\\+\\d{19}\\]", "淘口令变量"),
    SHORTLINK(1,"[短链接+%s]", "\\[短链接\\+\\d{19}\\]", "短链接变量"),
    TIKTOK_PWD(2,"[抖音口令+%s]", "\\[抖音口令\\+\\d{19}\\]", "抖音口令变量"),
    ;

    private Integer id;
    private String para;
    private String regex;
    private String desc;

    FdGoodsParaEnum(Integer id, String para, String regex, String desc) {
        this.id = id;
        this.para = para;
        this.regex = regex;
        this.desc = desc;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getPara() {
        return para;
    }

    public void setPara(String para) {
        this.para = para;
    }

    public String getRegex() {
        return regex;
    }

    public void setRegex(String regex) {
        this.regex = regex;
    }

    public static FdGoodsParaEnum getById(Integer id) {
        if (id == null) {
            return null;
        }
        for (FdGoodsParaEnum type: FdGoodsParaEnum.values()) {
            if (type.getId().intValue() == id.intValue()) {
                return type;
            }
        }
        return null;
    }
}
